package com.zr.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.zr.model.User;
import com.zr.service.Tcourseservicehh;
import com.zr.serviceImpl.TcourseserviceImplhh;

import net.sf.json.JSONArray;

public class FindTcouseControllerhh extends HttpServlet {
	Tcourseservicehh cdao=new TcourseserviceImplhh();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(req, resp);


	}
	@Override
		protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		req.setCharacterEncoding("UTF8");
		resp.setCharacterEncoding("UTF8");
		HttpSession session=req.getSession();
		User  s=(User) session.getAttribute("User");
		
		JSONArray cs=cdao.findcourse(s.getTid());
		PrintWriter  pw = resp.getWriter();
		
		pw.write(cs.toString());
		
		pw.flush();
		pw.close();
		
		
		
		
		}
}
